from langchain.memory import ConversationSummaryMemory
from langchain.llms import OpenAI
from dotenv import load_dotenv ,find_dotenv
_=load_dotenv(find_dotenv())
"""
ConversationSummaryMemory  对前面的多轮对话做摘要
buffer 是做摘要前的一个prompt
"""
memory = ConversationSummaryMemory(
  llm=OpenAI(temperature=0),
  buffer="This is the initial system message.",
  # buffer = 以中文表述
)
memory.save_context({"input": "你好"}, {"output": "你好！"})

print(memory.load_memory_variables({}))